package site.assad.quartz;

import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.context.ApplicationContext;

import java.util.Map;


/**
 * Author: Al-assad 余林颖
 * E-mail: yulinying_1994@outlook.com
 * Date: 2018/1/19 16:59
 * Description:
 */
public class MyJob implements Job{
    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
        Map dataMap = context.getJobDetail().getJobDataMap(); //获取储存在配置文件中的 DataMap

        String message = (String) dataMap.get("message");  //获取key="message"的value
        ApplicationContext applicationContext = (ApplicationContext) dataMap.get("applicationContext");  //获取Spring容器中的上下文对象
        System.out.println("message: "+message);
    }
}
